<?php foreach($data['flats'] as $k1=>$v1): ?>
  <div class='main-site-content-appartements-content-text-flat'>
  <div style='display: none' class='flat-ref'><?php echo $v1->cha_id; ?></div>
    <img src="<?php echo $data['baseurl']; ?>global/img/appartements/pictures/thumbnails/<?php  echo $data['pictures'][$v1->cha_id]['pictures'][0]?>" alt='<?php echo $data['pictures'][$v1->cha_id]['alt']?>'>
    <div class='main-site-content-appartements-content-tex-flat-content'>
      <div class='main-site-content-appartements-content-tex-flat-content-line'><span class='bold'>Emplacement </span>: <?php echo $v1->FrbFlatImmeuble->imm_adr; ?> à Marseille</div>
      <div class='main-site-content-appartements-content-tex-flat-content-line'><span class='bold'>Surface</span> : <?php echo $v1->cha_surf; ?> m²</div>
      <div class='main-site-content-appartements-content-tex-flat-content-line'> 
        <span class='bold'>Loyer à l'année</span> : <?php echo $v1->cha_loy_low; ?> €/mois 
        <span class='bold'> Pleine saison </span>: <a href='<?php echo $data['baseurl']; ?>contact' class='frb-popup-shadow'>nous contacter</a></div>
      <div class='main-site-content-appartements-content-tex-flat-content-line'><span class='bold'>Description : </span><?php echo $v1->cha_det; ?></div>
    </div>
  </div>
<?php endforeach; ?>
<script type="text/javascript">

oldToggle=null;
$('.main-site-content-appartements-content-text-flat').click(function(){
  if($(this).css('height') == '100px'){
    $(this).prevAll('.main-site-content-appartements-content-text-flat').hide('normal');
    $(this).animate({height : '300px'});
    if(oldToggle != null)
      oldToggle.animate({height : '100px'});
    oldToggle = $(this);
  }else if($(this).css('height') == '300px'){
    oldToggle = null;
    $(this).animate({height : '100px'});
    $('.main-site-content-appartements-content-text-flat').show('normal');
  }
});
</script>